<?php
class Ext_Services
{
	protected $log;
	protected $userId;
	protected $credential;
	
	protected $_config;
	
	public function __construct( )
	{
	    //$writer = new Zend_Log_Writer_Stream( 'log/generalTransaction.log' );
        //$this->log->addWriter( $writer );
        
		$this->_config = Zend_Registry::get('config');
	}
	
	protected function _validateCredential( $userId, $credential)
	{
		if( empty( $this->userId )) {
			$this->userId = $userId;
			$this->credential = $credential;	
		}
		if( empty($this->userId ) || empty($this->credential )) {
			throw new Ext_Exception ( 'Uno o mas parametros son incorrectos ' );
		}
		$user = new Ext_Model_User();
		if( $user->checkCredential( $this->userId, $this->credential )){
			return true;
		}else {
			throw new Ext_Exception ( 'Credential is broken');
		}
		
	}
}